#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>

Func _MetroUI_CreatePopupInput(ByRef $hGUI, $iX, $iY, $iWidth, $iHeight, $sBackground = 0xa0a0a0, $sForeground = 0xbebebe, $sDefaultText = "", $bAcceptDrag = False, $sTip = "", $sTipTitle = "", $sTipIcon = 0, $sFontSize = 14, $sFont = "Segoe UI Semilight")
	If $bAcceptDrag = True Then
		Local $hInputGUI = GUICreate("MetroUI Input", $iWidth, $iHeight + 6, $iX, $iY, $WS_POPUP, $WS_EX_ACCEPTFILES, $hGUI)
	Else
		Local $hInputGUI = GUICreate("MetroUI Input", $iWidth, $iHeight + 6, $iX, $iY, $WS_POPUP, Default, $hGUI)
	EndIf
	GUISetBkColor($sBackground, $hInputGUI)
	Local $hInput = GUICtrlCreateInput($sDefaultText, $iWidth / 16, 3, $iWidth / 8 * 7, $iHeight - 3)
	If $bAcceptDrag = True Then GUICtrlSetState(-1, $GUI_DROPACCEPTED)
	If $sTip <> "" Then GUICtrlSetTip(-1, $sTip, $sTipTitle, $sTipIcon, 1)
	GUICtrlSetFont(-1, $sFontSize, 200, 0, $sFont)
	GUICtrlSetBkColor(-1, $sForeground)
	GUISetState(@SW_SHOW)
	Local $aReturn[2] = [$hInputGUI, $hInput]
	Return $aReturn
EndFunc   ;==>_MetroUI_CreatePopupInput

Func _MetroUI_CreateInput(ByRef $hGUI, $iX, $iY, $iWidth, $iHeight, $sForeground = 0xcfcfcf, $sFontSize = 14, $sFont = "Segoe UI Semilight")
	GUISwitch($hGUI)
	Local $hInput = GUICtrlCreateInput("", $iX, $iY, $iWidth, $iHeight)
	GUICtrlSetFont(-1, $sFontSize, 200, 0, $sFont)
	GUICtrlSetBkColor(-1, $sForeground)
	Return $hInput
EndFunc   ;==>_MetroUI_CreateInput

Func _MetroUI_CreateButton(ByRef $hGUI, $sText, $iX, $iY, $iWidth, $iHeight, $sBorder = 0xff287acc, $sBackground = 0xff3399ff, $sTextColour = 0xffffffff, $iBtnWeight = 4, $sFontSize = 20, $sFont = "Segoe UI Semilight")
	GUISwitch($hGUI)
	Local $hZone = GUICtrlCreateLabel("", $iX, $iY, $iWidth, $iHeight)
	GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
	Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
	Local $hPen = _GDIPlus_PenCreate($sBorder, $iBtnWeight)
	Local $hBrush = _GDIPlus_BrushCreateSolid($sBackground)
	Local $hTextBrush = _GDIPlus_BrushCreateSolid($sTextColour)
	Local $hFormat = _GDIPlus_StringFormatCreate()
	Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
	Local $hFont = _GDIPlus_FontCreate($hFamily, $sFontSize, 0, 2)
	Local $tLayout = _GDIPlus_RectFCreate($iX + $iWidth / 8, $iY - $iHeight / 16, $iWidth / 8 * 7, $iHeight)
	Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sText, $hFont, $tLayout, $hFormat)
	_GDIPlus_GraphicsDrawRect($hGraphics, $iX, $iY, $iWidth, $iHeight, $hPen)
	_GDIPlus_GraphicsFillRect($hGraphics, $iX, $iY, $iWidth, $iHeight, $hBrush)
	_GDIPlus_GraphicsDrawStringEx($hGraphics, $sText, $hFont, $aInfo[0], $hFormat, $hTextBrush)
	_GDIPlus_GraphicsDispose($hGraphics)
	_GDIPlus_PenDispose($hPen)
	_GDIPlus_BrushDispose($hTextBrush)
	_GDIPlus_BrushDispose($hBrush)
	_GDIPlus_FontFamilyDispose($hFamily)
	_GDIPlus_FontDispose($hFont)
	_GDIPlus_GraphicsDispose($hGraphics)
	Return $hZone
EndFunc   ;==>_MetroUI_CreateButton

Func _MetroUI_CreateLabel(ByRef $hGUI, $sText, $iX, $iY, $iWidth, $iHeight, $sFontSize = 8.5, $sColor = 0x000000)
	GUISwitch($hGUI)
	Local $hLabel = GUICtrlCreateLabel($sText, $iX, $iY, $iWidth, $iHeight)
	GUICtrlSetFont(-1, $sFontSize, 300, 0, "Segoe UI Semilight")
	GUICtrlSetColor(-1, $sColor)
	GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
	Return $hLabel
EndFunc   ;==>_MetroUI_CreateLabel
